package com.blb.zycommunity.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blb.zycommunity.entity.ZyBuilding;
import com.blb.zycommunity.entity.ZyRoom;
import com.blb.zycommunity.mapper.ZyBuildingMapper;
import com.blb.zycommunity.service.IZyBuildingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 楼栋  服务实现类
 * </p>
 *
 * @author chenheng
 * @since 2023-11-20
 */
@Service
public class ZyBuildingServiceImpl extends ServiceImpl<ZyBuildingMapper, ZyBuilding> implements IZyBuildingService {

    @Resource
    private ZyBuildingMapper zyBuildingMapper;

    @Override
    public IPage<ZyBuilding> findBuildingPage(Page<ZyBuilding> page, String buildingName, String buildingCode) {
        return zyBuildingMapper.selectBuildingPage(page, buildingName, buildingCode);
    }

    @Override
    public ZyBuilding findBuildingById(String buildingId) {
        return zyBuildingMapper.selectZyBuildingById(buildingId);
    }

    @Override
    public List<ZyBuilding> getBuildingAndUnit() {
        return zyBuildingMapper.selectBuildingAndUnit();
    }

    @Override
    public List<ZyBuilding> findBuildingByCommunityId(String communityId) {
        return zyBuildingMapper.selectBuildingByCommunity(communityId);
    }
}
